// 统计数组arr中值等于item的元素出现的次数

const arr = [1, 2, 4, 4, 3, 4, 3]

function count(arr, item) {
    return arr.reduce((prev, current, index, array) => {
       console.log('1',prev);
       if (item == current) {
           prev = prev + 1
           console.log(prev);
     }
    
    }, 0)
}

console.log(count(arr, 4));